-
Notifications
You must be signed in to change notification settings - Fork 12
DRBalancerVault contract for system DR rebalancing #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aalavandhan
wants to merge
5
commits into
main
Choose a base branch
from
dr-balancer-vault
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DRBalancerVault contract for system DR rebalancing
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
404525b to
ecdf37e
Compare
… and auto-rebalances to maintain the system's target deviation ratio via IRolloverVault swaps.
Key features:
- Deposit underlying tokens and mint vault notes (LP tokens)
- Redeem notes for proportional underlying + perp tokens
- Auto-rebalance when system DR is outside equilibrium zone:
DR < 1 (perpTVL too high): redeem perps to decrease perpTVL
DR > 1 (perpTVL too low): mint perps to increase perpTVL
- Rebalance formula: requiredChange = perpTVL × |dr - targetDR|
(rolloverVaultTVL unchanged during flash mint/redeem)
- Liquidity limits based on swap direction:
underlying->perp: limited by underlying balance
perp->underlying: limited by perp value held
- Separate lag factors and percentage limits for each direction
- Slippage protection with configurable max swap fee percentage
- Keeper-controlled pause functionality.
ecdf37e to
173047c
Compare
brandoniles
reviewed
Feb 2, 2026
…page protection - Update deposit() to accept both underlying and perp tokens with signature: deposit(underlyingAmtMax, perpAmtMax, minNotesMinted) - Update redeem() to include slippage protection with signature: redeem(notesAmt, minUnderlyingAmtOut, minPerpAmtOut) - Update computeMintAmt() to return (notesMinted, underlyingAmtIn, perpAmtIn) - First deposit accepts any ratio; subsequent deposits enforce vault ratio - Update Deposited event to include perpAmtIn - Fix lag factor comments (swapped DR conditions) - Add InvalidLagFactor validation to prevent division by zero - Update contract docstring to reflect dual-token deposits Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
brandoniles
reviewed
Feb 3, 2026
brandoniles
reviewed
Feb 4, 2026
| Range memory equilibriumDR_ | ||
| ) external onlyOwner { | ||
| if ( | ||
| equilibriumDR_.lower >= equilibriumDR_.upper || |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be able to configure a range of size zero and allow it to be just the target.
b5bcd53 to
f554000
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement a vault that holds underlying (AMPL) and perp (SPOT) tokens and auto-rebalances to maintain the system's target deviation ratio via IRolloverVault swaps.
Key features:
(rolloverVaultTVL unchanged during flash mint/redeem)